package com.cool.collect.springcode.a05;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.support.GenericApplicationContext;

import java.io.IOException;

/**
 * @author xiemiao
 * @description
 * @date 2023/08/29
 */
public class A05Application {
    private static final Logger log = LoggerFactory.getLogger(A05Application.class);

    public static void main(String[] args) throws IOException {
        GenericApplicationContext context = new GenericApplicationContext();
        context.registerBean("config", Config.class);
        // @ComponentScan @Bean @ImportResource
        // context.registerBean(ConfigurationClassPostProcessor.class);

        // context.registerBean(ComponentScanPostProcessor.class);

        // 解析@Bean
        context.registerBean(AtBeanPostProcessor.class);
        // 解析Mapper接口
        context.registerBean(MapperPostProcessor.class);

        // 初始化容器
        context.refresh();

        for (String name : context.getBeanDefinitionNames()) {
            System.out.println(name);
        }
        // 销毁容器
        context.close();
    }
}
